const addStudent = require('../lib/addStudent.js');
const addID = require('../lib/addID.js');
const print = require('../lib/print.js');

//菜单主界面
function menu(){
    let str = `    1. 添加学生
    2. 生成成绩单
    3. 退出
    请输入你的选择（1～3）：`;
    console.log(str);
    return str;
}

module.exports = main;
function main(){
    let student;
    let studentid;
    menu();
    let num = readlineSync.question();
    if(num === "1"){
        student = addStudent();
    }
    else if(num === "2"){
        studentid = addID();
        if(studentid){
            print(student,studentid);
        }
    }
    else if(num === "3"){
        console.log("确认退出");
        return 0;
    }
    else{
        console.log("输入错误");
        return 0;
    }
}

// npm install readline-sync